package com.ruoyi.transaction.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.transaction.mapper.ProductSpecMapper;
import com.ruoyi.common.entity.TransactionEntity.ProductSpec;
import com.ruoyi.transaction.service.IProductSpecService;

/**
 * 商品规格Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-08
 */
@Service
public class ProductSpecServiceImpl implements IProductSpecService 
{
    @Autowired
    private ProductSpecMapper productSpecMapper;

    /**
     * 查询商品规格
     * 
     * @param id 商品规格主键
     * @return 商品规格
     */
    @Override
    public ProductSpec selectProductSpecById(Long id)
    {
        return productSpecMapper.selectProductSpecById(id);
    }

    /**
     * 查询商品规格列表
     * 
     * @param productSpec 商品规格
     * @return 商品规格
     */
    @Override
    public List<ProductSpec> selectProductSpecList(ProductSpec productSpec)
    {
        return productSpecMapper.selectProductSpecList(productSpec);
    }

    /**
     * 新增商品规格
     * 
     * @param productSpec 商品规格
     * @return 结果
     */
    @Override
    public int insertProductSpec(ProductSpec productSpec)
    {
        productSpec.setCreateTime(DateUtils.getNowDate());
        return productSpecMapper.insertProductSpec(productSpec);
    }

    /**
     * 修改商品规格
     * 
     * @param productSpec 商品规格
     * @return 结果
     */
    @Override
    public int updateProductSpec(ProductSpec productSpec)
    {
        productSpec.setUpdateTime(DateUtils.getNowDate());
        return productSpecMapper.updateProductSpec(productSpec);
    }

    /**
     * 批量删除商品规格
     * 
     * @param ids 需要删除的商品规格主键
     * @return 结果
     */
    @Override
    public int deleteProductSpecByIds(Long[] ids)
    {
        return productSpecMapper.deleteProductSpecByIds(ids);
    }

    /**
     * 删除商品规格信息
     * 
     * @param id 商品规格主键
     * @return 结果
     */
    @Override
    public int deleteProductSpecById(Long id)
    {
        return productSpecMapper.deleteProductSpecById(id);
    }
}
